<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>JSON</title>
	</head>
	<body>
		<h1>JSON对象创建</h1>
		<script>
			person = {
				name:'Jack',
				age : 20,
				addr:{
					homeAddr:'太原迎泽',   //对象嵌套
					workAddr:'太原小店'
				}
			};
			alert(person.name);
			alert(person['age']);
			alert(person.addr.homeAddr);
			students= [
				{name:'xky',age:22},        //数组下加对象
				{name:'zhaolaoshi',age:40}
			];
			alert(students[1].age);   //数组取值
			s = {
				
    				"sites": [
    				{ "name":"菜鸟教程" , "url":"www.runoob.com" }, 
    				{ "name":"google" , "url":"www.google.com" }, 
    				{ "name":"微博" , "url":"www.weibo.com" }
    				]
			}
			alert(s.sites[2].name);
			alert(s.sites[2].url);
		</script>
	</body>
</html>
